<template>
	<div id="index">
		<!-- <div id="head">

		</div> -->
		<div id="main">
			<!-- <el-button @click="isCollapse=!isCollapse">默认按钮</el-button> -->
			<el-menu default-active="1-4-1" class="el-menu-vertical-demo" :router="true" @open="handleOpen" @close="handleClose"
			 :collapse="isCollapse">
				<el-menu-item index="/home">
					<i class="el-icon-house"></i>
					<span slot="title">HOME</span>
				</el-menu-item>
				<el-menu-item index="/seniority">
					<i class="el-icon-s-custom"></i>
					<span slot="title">资格</span>
				</el-menu-item>
				<el-menu-item index="/map">
					<i class="el-icon-map-location"></i>
					<span slot="title">地图</span>
				</el-menu-item>
				<el-menu-item index="/about">
					<i class="el-icon-share"></i>
					<span slot="title">关于</span>
				</el-menu-item>
				<el-menu-item id="collapse" @click="isCollapse=!isCollapse;">
					<i class="el-icon-caret-left" v-if="!isCollapse"></i>
					<i class="el-icon-caret-right" v-if="isCollapse"></i>
				</el-menu-item>
			</el-menu>
			<div id="mainbody">
				<router-view></router-view>
			</div>
		</div>

	</div>
</template>

<script>
	export default {
		name: 'index',
		data() {
			return {
				isCollapse: true,
			}
		},
		methods: {
			handleOpen(key, keyPath) {
				console.log(key, keyPath);
			},
			handleClose(key, keyPath) {
				console.log(key, keyPath);
			}
		},
	}
</script>

<style scoped>
	#head {
		width: 100%;
		height: 100px;
		background-color: #e1e1e1;
	}

	#main {
		display: flex;
		width: 100%;
		height: 100vh;
		background-color: #ffffff;
	}

	.el-menu-vertical-demo:not(.el-menu--collapse) {
		width: 200px;
		min-height: 600px;
	}

	.el-menu-vertical-demo {
		display: inline-block;
		/* float: left; */
		height: 100vh;
		width: 65px;
	}

	#mainbody {
		display: inline-block;
		height: 100%;
		width: 100%;
	}
	#collapse{
		position: absolute;
		bottom: 0;
	}
</style>
